<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* 实训
*/
class Shixun extends MY_Controller {

	public function index()
	{	
		$post_data = $this->input->post();
		if(empty($post_data['uid'])){
            $result['code'] = 10005;
            $result['data'] = array();
            // $result['msg'] = '缺少UID';
		}else{
			$this->load->model("User_model");
			$shixun_list = $this->User_model->get_usre_shixun_order($post_data['uid']);
			$shixun_data = array();
			if($shixun_list){
				foreach ($shixun_list as $key => $value) {
					$shixun_data[] = $value['data_id'];
				}
			}
			$result['code'] = 200;
			$result['data'] = $shixun_data;
		}
		echo json_encode($result);
	}

	function get_school_list(){
		
		$post_data = $this->input->post();
		$limit = !empty($post_data['limit']) ? $post_data['limit'] - 1 : 0;
		$offset = !empty($post_data['offset']) ? $post_data['offset'] : $this->offset;
		if($offset > 30){
			$offset = 30;
		}
		$this->load->model("Schools");
		$school_list = $this->Schools->get_school_list($limit, $offset);
		$result['code'] = 200;
		$result['data'] = $school_list;
		echo json_encode($result);
	}
}

